package gameserver.utils;


import java.util.concurrent.FutureTask;

import com.my.commons.utils.concurrent.ExecuteWrapper;

public class InterruptableTask extends ExecuteWrapper
{
	FutureTask<?> task;
	
	protected long noWarnMilliseconds = 0;
	
	public InterruptableTask(FutureTask<?> task,long noWarnMilliseconds)
	{
		super(task);
		this.task = task;
		this.noWarnMilliseconds = noWarnMilliseconds;
	}
	
	@Override
	protected long getMaximumRuntimeInMillisecWithoutWarning()
	{
		return noWarnMilliseconds;
	}
	
	public boolean cancel()
	{
		return task.cancel(true);
	}
}
